import 'dart:collection';

class NearbyCourtsModel {
  int? courtId;
  String? courtName;
  String? courtAddress;
  String? meter;
  List<Images>? images;

  NearbyCourtsModel(
      {this.courtId,
      this.courtName,
      this.courtAddress,
      this.meter,
      this.images});

  NearbyCourtsModel.fromJson(Map<String, dynamic> json) {
    courtId = json['courtId'];
    courtName = json['courtName'];
    courtAddress = json['courtAddress'];
    meter = json['meter'];
    if (json['images'] != null) {
      images = <Images>[];
      json['images'].forEach((v) {
        if (v != null) {
           images!.add( Images.fromJson(v));
        }
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = HashMap();
    data['courtId'] = courtId;
    data['courtName'] = courtName;
    data['courtAddress'] = courtAddress;
    data['meter'] = meter;
    if (images != null) {
      data['images'] = images!.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class Images {
  int? courtBaseInfoId;
  String? courtImageUrl;
  String? courtImageTitle;

  Images({this.courtBaseInfoId, this.courtImageUrl, this.courtImageTitle});

  Images.fromJson(Map<String, dynamic> json) {
    courtBaseInfoId =json['courtBaseInfoId'];
    courtImageUrl = json['courtImageUrl'];
    courtImageTitle = json['courtImageTitle'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = HashMap();
    data['courtBaseInfoId'] = courtBaseInfoId;
    data['courtImageUrl'] = courtImageUrl;
    data['courtImageTitle'] = courtImageTitle;
    return data;
  }
}